package com.fhz.kotlintest

import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.launch

/**
 * 时间:2022/1/4
 * @author msfeng
 * 简述: TODO
 */
class FoodViewModel :ViewModel() {

    val food by lazy {
        MutableLiveData<Food>()
    }
    fun getFood() {
        viewModelScope.launch {
            val food1 = RetrofitManager.createApi(UserApi::class.java).getFood().await()
            food.value = food1
            Log.d("ViewPagerViewModel", "getArticle: $food1")
        }
    }
}